{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# scikit-learn中的多项式回归和Pipeline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.random.uniform(-3,3,size=100)\n",
    "X = x.reshape(-1,1)\n",
    "y = 0.5 * x**2 + x + 2 + np.random.normal(0, 1, size=100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "把特征扩大1倍，本质上也是数据预处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing.data import PolynomialFeatures"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 3)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly = PolynomialFeatures(degree=2)\n",
    "poly.fit(X)\n",
    "X2 = poly.transform(X)\n",
    "X2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((100, 1), (100, 3))"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape, X2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.        ,  0.22086515,  0.04878142],\n       [ 1.        , -0.77678021,  0.6033875 ],\n       [ 1.        ,  2.08885376,  4.36331005],\n       [ 1.        , -1.93171647,  3.73152854],\n       [ 1.        ,  2.49741083,  6.23706086]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 它已经自动帮我们增加了一个常数，代表0次列\n",
    "X2[:5,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/scipy/linalg/basic.py:1226: RuntimeWarning: internal gelsd driver lwork query error, required iwork dimension not returned. This is likely the result of LAPACK bug 0038, fixed in LAPACK 3.2.2 (released July 21, 2010). Falling back to 'gelss' driver.\n  warnings.warn(mesg, RuntimeWarning)\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "lin_reg2 = LinearRegression()\n",
    "lin_reg2.fit(X2, y)\n",
    "y_predict2 = lin_reg2.predict(X2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3Xl8lNW9x/HPjxAgoBgUVAgguOGGiqaIcvW6oChWidQFitatRVt7XYui3pa2brRYq9XqFaxtRatY1LigBhWs1g2DoCiLxQUxgKIQUAmShHP/OAlmmUlmeWaemcn3/XrlFTKZmec8Ifk95/md3znHnHOIiEj2axd2A0REJBgK6CIiOUIBXUQkRyigi4jkCAV0EZEcoYAuIpIjFNBFRHKEArqISI5QQBcRyRHt03mw7t27u379+qXzkCIiWW/evHlfOOd6tPa8tAb0fv36UV5ens5DiohkPTNbHsvzlHIREckRrQZ0M7vXzD43s3cbPLa9mT1nZv+p+9wttc0UEZHWxNJD/xtwfJPHJgAvOOf2AF6o+1pERELUakB3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jjioAVDb7+lCwOGrnKzPoBg4A3wm1Jcswsz8wWAJ8DzznnUnI+oQd0M3vezN6N8DESwDl3rXOuD/AA8PNwW9uy1s6l7jnXAjX488losZyPSKqY2TbAI8ClTe7Ws45zrtY5dyD+znywmaUkLRb6jkXOuWExPvUB4GlgYgqbk5TWzsXMzgG+DxzjMnnwok4c/zfZqALo0+Dr3nWPSQaoyzU/AjzgnHs07PYExTlXaWZzgOOBwAewQ++ht8TM9mjw5UhgSVhtSZaZHQ9cCZzsnNsYdnuEN4E9zKy/mXUARgNPhNwmYesg4l+Axc65W8JuT7LMrEd9VZuZFeAH4lMSyzK9yuURYAC+mmI5cKFzLit7UWa2DOgIfFn30OvZWrEDYGanALcDPYBKYIFzbni4rYqPmY0AbgXygHudczeE3KSEmdmDwJH4Ff0+AyY65/4SaqMSZGb/BbwMLMT/7QNc45x7OrxWJc7M9gf+jv89awc87Jz7bUqOlckBXUREYpfRKRcREYmdArqISI5QQBcRyREK6CIiOUIBXUQkRyigi4jkCAV0EZEcoYAuIpIj/h8lAINg7l/75gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x108ba7588>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x,y)\n",
    "plt.plot(np.sort(x), y_predict2[np.argsort(x)], color='r')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.        ,  0.97047809,  0.47590158])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lin_reg2.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.9998190041963848"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lin_reg2.intercept_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 关于PolynomialFeatures"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2元2次"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5, 2)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = np.arange(1, 11).reshape(-1,2)\n",
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  2],\n       [ 3,  4],\n       [ 5,  6],\n       [ 7,  8],\n       [ 9, 10]])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5, 6)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly = PolynomialFeatures(degree=2)\n",
    "poly.fit(X)\n",
    "X2 = poly.transform(X)\n",
    "X2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[   1.,    1.,    2.,    1.,    2.,    4.],\n       [   1.,    3.,    4.,    9.,   12.,   16.],\n       [   1.,    5.,    6.,   25.,   30.,   36.],\n       [   1.,    7.,    8.,   49.,   56.,   64.],\n       [   1.,    9.,   10.,   81.,   90.,  100.]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X2\n",
    "\n",
    "# 第4列为第2列的平方\n",
    "# 第5列为第2列与第3列的乘积\n",
    "# 第6列为第3列的平方"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3元2次"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  1.,   1.,   2.,   3.,   1.,   2.,   3.,   4.,   6.,   9.],\n       [  1.,   4.,   5.,   6.,  16.,  20.,  24.,  25.,  30.,  36.],\n       [  1.,   7.,   8.,   9.,  49.,  56.,  63.,  64.,  72.,  81.]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = np.arange(1, 10).reshape(-1,3)\n",
    "poly = PolynomialFeatures(degree=2)\n",
    "poly.fit(X)\n",
    "X2 = poly.transform(X)\n",
    "X2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2元3次"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[    1.,     1.,     2.,     1.,     2.,     4.,     1.,     2.,\n            4.,     8.],\n       [    1.,     3.,     4.,     9.,    12.,    16.,    27.,    36.,\n           48.,    64.],\n       [    1.,     5.,     6.,    25.,    30.,    36.,   125.,   150.,\n          180.,   216.],\n       [    1.,     7.,     8.,    49.,    56.,    64.,   343.,   392.,\n          448.,   512.],\n       [    1.,     9.,    10.,    81.,    90.,   100.,   729.,   810.,\n          900.,  1000.]])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = np.arange(1, 11).reshape(-1,2)\n",
    "poly = PolynomialFeatures(degree=3)\n",
    "poly.fit(X)\n",
    "X2 = poly.transform(X)\n",
    "X2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pipeline\n",
    "将3个步骤合在一起：多项式特征，数据归一化，线性回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.random.uniform(-3,3,size=100)\n",
    "X = x.reshape(-1,1)\n",
    "y = 0.5 * x**2 + x + 2 + np.random.normal(0, 1, size=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.pipeline import Pipeline\n",
    "from sklearn.preprocessing.data import StandardScaler\n",
    "\n",
    "poly_reg = Pipeline([\n",
    "    ('poly', PolynomialFeatures(degree=2)),\n",
    "    ('std_scaler', StandardScaler()),\n",
    "    ('lin_reg', LinearRegression())\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "poly_reg.fit(X, y)\n",
    "y_predict = poly_reg.predict(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3Xl8VNXdx/HPIQYJoAYkRYgKuIC1olBjXyrWBa0gVAm27rV1aZG22morlta2qK0PWOtCfdSqfbTVWnHDuKEgBRUXlCAIKoJYhRIVURZBggI5zx8ngSyz33vn3jvzfb9eeZFMbu6cGWZ+c+7v/M45xlqLiIjEX7uwGyAiIv5QQBcRKRAK6CIiBUIBXUSkQCigi4gUCAV0EZECoYAuIlIgFNBFRAqEArqISIHYIZ931q1bN9u7d+983qWISOzNnTv3E2ttRbrj8hrQe/fuTW1tbT7vUkQk9owxyzI5TikXEZECoYAuIlIgFNBFRAqEArqISIFQQBcRKRAK6CIiBSKvZYsiInFUM6+Oa6cu5oO19fQsL2PMkH5UD6wMu1ltKKCLiKRQM6+OX09eSP3mrQDUra3n15MXAkQuqCvlIiKSwrVTF28L5k3qN2/l2qmLQ2pRcgroIiIpfLC2Pqvbw6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jDHzjTHTjDE9w25Trowx1xpj3m58PI8YY8rDblMujDGnGGPeNMY0GGNiWZFQKHvjGmPuNMZ8bIx5I+y2eGGM2cMYM9MY81bja+vnYbcpV8aYDsaYV40xrzc+lisDvb84pVyMMTtbaz9r/P5nwP7W2tEhNysnxpjjgRmNq1ZeA2Ct/VXIzcqaMearQANwG3CptbY25CZlpXFv3CXAt3C7bs0BzrDWvhVqw3JgjDkS2ADcba09IOz25MoY0wPoYa19zRizEzAXqI7p/4kBOllrNxhjSoEXgJ9ba2cHcX+x6qE3BfNGnaDNVpOxYa2dZq3d0vjjbNwGIbFjrV1krY3z5p4FszeutfZ5YHXY7fDKWvuhtfa1xu/XA4uI6faW1tnQ+GNp41dgcStWAR3AGHO1Mea/wFnA78Nuj0/OA54KuxFFSnvjRpgxpjcwEHgl3JbkzhhTYoyZD3wMPGOtDeyxRC6gG2OmG2PeSPA1AsBae7m1dg/gXuDCcFubWrrH0njM5cAW3OOJpEweh4jfjDGdgYeBi1tdnceKtXartXYA7ir8G8aYwNJhnja4CIK19rgMD70Xt7nGuACb40m6x2KMOQf4NnCsjfBgRhb/J3GU0d64kl+N+eaHgXuttZPDbo8frLVrjTEzgaFAIAPXkeuhp2KM2bfZjyOAt8Nqi1fGmKHAZcBJ1tqNYbeniG3bG9cY0x63N+5jIbepqDUOJP4fsMhae33Y7fHCGFPRVMFmjCnDDb4HFrfiVuXyMNAPV1WxDBhtrY1lb8oYsxTYEfi08abZcazYMcaMBG4CKoC1wHxr7ZBwW5UdY8ww4Ea27417dchNyokx5j7gaNzKfiuBcdba/wu1UTkwxhwBzAIW4t7rAL9p3PIyVowxBwL/wL222gEPWGuvCuz+4hTQRUQkuVilXEREJDkFdBGRAqGALiJSIBTQRUQKhAK6iEiBUEAXESkQCugiIgVCAV1EpED8P58nmVJWRbE6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x108c4d4a8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x,y)\n",
    "plt.plot(np.sort(x), y_predict[np.argsort(x)], color='r')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
